// 文章相关的接口
import request from '@/utils/request'

// 获取文章列表
export const getAllArticle = (obj) => {
  return request({
    method: 'GET',
    url: '/v1_0/articles',
    params: obj,
  })
}

// 获取文章详情
export const getArticleDetail = (article_id) => {
  return request({
    method: 'GET',
    url: `/v1_0/articles/${article_id}`,
  })
}

// 不感兴趣
export const NotLike = (target) => {
  return request({
    method: 'POST',
    url: '/v1_0/article/dislikes',
    data: {
      target,
    },
  })
}

// 举报
export const ReportArticle = (obj) => {
  return request({
    method: 'POST',
    url: '/v1_0/article/reports',
    data: obj,
  })
}

// 关注作者
export const Followauthor = (target) => {
  return request({
    method: 'POST',
    url: '/v1_0/user/followings',
    data: {
      target,
    },
  })
}

// 取消关注作者
export const UnFollowauthor = (target) => {
  return request({
    method: 'DELETE',
    url: `/v1_0/user/followings/${target}`,
  })
}

// 点赞
export const Like = (target) => {
  return request({
    method: 'POST',
    url: '/v1_0/article/likings',
    data: {
      target,
    },
  })
}

// 取消点赞
export const UnLike = (target) => {
  return request({
    method: 'DELETE',
    url: `/v1_0/article/likings/${target}`,
  })
}

// 收藏
export const Collect = (target) => {
  return request({
    method: 'POST',
    url: '/v1_0/article/collections',
    data: {
      target,
    },
  })
}

// 取消收藏
export const UnCollect = (target) => {
  return request({
    method: 'DELETE',
    url: `/v1_0/article/collections/${target}`,
  })
}
